import fetch from '@/utils/fetch';
import { EBIZ_API } from '@/config/baseUrl';

//拉取首页精品推荐广告列表
export function getHomeAdList(params) {
	return fetch({
	    url: EBIZ_API + '/appAdmin_ad/list.do',
	    method: 'get',
	    params
  	})
}

//枚举拉取首页精品推荐广告类型
export const adType={
	2:"url",
	10:"超市商品详情",
	11:"餐饮商品详情",
	12:"团购商品详情",
	20:"超市商品分类列表",
	21:"餐饮商品分类列表",
	22:"团购商品分类列表"
}

//新增首页精品推荐广告拉取跳转值
export function getJumpValue(params) {
	return fetch({
	    url: EBIZ_API + '//appAdmin_goods/listAll.do',
	    method: 'post',
	    params
  	})
}

//编辑保存首页精品广告
export function editAd(data){
	return fetch({
		url: EBIZ_API + '//appAdmin_ad/edit.do',
		method: 'post',
		data
	})
}

//新增首页精品推荐广告
export function addAd(data) {
	return fetch({
	    url: EBIZ_API + '//appAdmin_ad/save.do',
	    method: 'post',
	    data
  	})
}

//拉取对应id的广告信息（编辑使用）
export function getAd(params) {
	return fetch({
	    url: EBIZ_API + '/appAdmin_ad/getInfo.do',
	    method: 'get',
	    params
  	})
}

//执行对应广告
export function useAd(data) {
	return fetch({
	    url: EBIZ_API + '/appAdmin_ad/delete2.do',
	    method: 'post',
	    data
  	})
}

//------------------------------------------

//拉取促销列表
export function getPromotionList(params) {
	return fetch({
	    url: EBIZ_API + '/appAdmin_promotion/list.do',
	    method: 'get',
	    params
  	})
}

//根据商品类型拉取商品名称
export function getName(params) {
	return fetch({
	    url: EBIZ_API + '//appAdmin_goods/listAll.do',
	    method: 'post',
	    params
  	})
}

//新增促销商品
export function addGoods(data) {
	return fetch({
	    url: EBIZ_API + '//appAdmin_promotion/save.do',
	    method: 'post',
	    data
  	})
}

//促销管理逻辑删除
export function deleteGoods(data){
	return fetch({
		url: EBIZ_API + '/appAdmin_promotion/delete.do',
		method: 'post',
		data
	})
}

//拉取商品详细
export function getGoodsDetail(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_promotion/getInfo.do',
		method: 'get',
		params
	})
}

//更新促销商品
export function editGoods(data){
	return fetch({
		url: EBIZ_API + '//appAdmin_promotion/edit.do',
		method: 'post',
		data
	})
}

//----------------------------------------

//拉取热搜词列表
export function getHotWordsList(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_hotkeyword/list.do',
		method: 'get',
		params
	})
}

//删除热搜词
export function deleteHotWord(data){
	return fetch({
		url: EBIZ_API + '/appAdmin_hotkeyword/delete.do',
		method: 'post',
		data
	})
}

//新增热搜词
export function addHotWord(data){
	return fetch({
		url: EBIZ_API + '//appAdmin_hotkeyword/save.do',
		method: 'post',
		data
	})
}

//拉取热搜词详细
export function getHotWordDetail(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_hotkeyword/getInfo.do',
		method: 'get',
		params
	})
}

//更新热搜词
export function editHotWord(data){
	return fetch({
		url: EBIZ_API + '//appAdmin_hotkeyword/edit.do',
		method: 'post',
		data
	})
}

//-------------------------------------------------------

//拉取代金券类型列表
export function getCashCouponList(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_coupon/list.do',
		method: 'get',
		params
	})
}

//拉取代金券详细
export function getCashCouponDetail(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_coupon/getInfo.do',
		method: 'get',
		params
	})
}

//更新代金券
export function editCashCoupon(data){
	return fetch({
		url: EBIZ_API + '//appAdmin_coupon/edit.do',
		method: 'post',
		data
	})
}

//-------------------------------------------

//拉取用户代金券列表
export function getUserCouponList(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_user_coupon/list.do',
		method: 'get',
		params
	})
}

//-----------------------------------------------

//拉取评论管理列表
export function getCommentList(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_comment/list.do',
		method: 'get',
		params
	})
}

//审核评论
export function checkComment(data){
	return fetch({
		url: EBIZ_API + '/appAdmin_comment/edit.do',
		method: 'post',
		data
	})
}

//-----------------------------------------------------

//拉取账户信息管理列表
export function getAccountList(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_store/list.do',
		method: "get",
		params
	})
}

//拉取店铺详细
export function getShopDetail(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_store/getInfo.do',
		method: 'get',
		params
	})
}

//更改账户管理信息
export function editAccount(data){
	return fetch({
		url: EBIZ_API + '//appAdmin_store/edit.do',
		method: 'post',
		data
	})
}

//-------------------------------------------

//拉取订单列表
export function getOrderList(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_order/list.do',
		method: 'get',
		params
	})
}

//拉取金额详细
export function getPriceDetail(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_order_detail/getPriceInfo.do',
		method: 'get',
		params
	})
}

//拉取订单商品信息
export function getCommentDetail(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_order_detail/getGoodsInfo.do',
		method: 'get',
		params
	})
}

//确认订单
export function confirmOrder(data){
	return fetch({
		url: EBIZ_API + '//appAdmin_order/edit',
		method: 'post',
		data
	})
}

//拉取配货员
export function getDistributionUser(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_order/allocation.do',
		method: 'get',
		params
	})
}

//确认收货码
export function isokCode(data){
	return fetch({
		url:EBIZ_API + '//appAdmin_order/edit2',
		method:'post',
		data
	})
}

//保存配货员
export function saveDistributionUser(data){
	return fetch({
		url: EBIZ_API + '//appAdmin_delivery/save.do',
		method: 'post',
		data
	})
}

//查看参团信息
export function getGroupPurchase(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_group_goods_user/getUserInfo',
		method: 'get',
		params
	})
}

//查看配送信息
export function getDistributionInfo(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_order/goLook.do',
		method: 'get',
		params
	})
}

//查看红包/配送管理详细
export function getRedEnvelopesDetail(params){
	return fetch({
		url: EBIZ_API + '/appAdmin_information/getInfo',
		method: 'get',
		params
	})
}

//编辑红包/配送管理
export function updateRedEnvelopes(data){
	return fetch({
		url: EBIZ_API + '/appAdmin_information/edit',
		method: 'post',
		data
	})
}

//首页拉取经营收益统计数据
export function getOrderPriceRate(){
	return fetch({
		url: EBIZ_API + '/appAdmin_order_detail/getOrderPriceRate',
		method: 'get'
	})
}

//拉取导出excel数据
export function getExcel(data,type,start,end){
	return fetch({
		url: EBIZ_API + `/appAdmin_order_detail/excel2?TYPE=${type}&START=${start}&END=${end}`,
		method:"post",
		data
	})
}

//导出excel表头字段映射
export const excelKey={
	ORDERTYPE:"订单类型",
	PAYSTATUS:"支付状态",
	ORDERNO:"订单号",
	GOODSMONEY:"商品总价(元)",
	COUPONPAY:"抵扣金额(元)",
	PACKFEE:"打包费(元)",
	SHIPPINGFEE:"配送费(元)",
	GOODSINFO:"商品信息",
	SHINPTYPE:"配送方式",
	ADDTIME:"创建时间",
	ORDERSTATUS:"订单状态",
	SHIPPINGSTATUS:"配送状态",
	ORDERPAYNO:"商户支付号",
	PAYTIME:"支付时间",
	RETURNTIME:"退款时间",
	ONLINEPAY:"实际支付金额(元)",
	BALANCEPAY:"余额支付金额(元)",
	CONSIGNEE:"收货人",
	URGESTATUS:"是否催单",
	STORE_ID:"店铺ID",
	ADDRESS:"详细地址",
	ROOM_ID:"房间ID",
	USER_ID:"店主ID",
	STORENAME:"店铺名称",
	TEL:"店铺电话",
	CONFIRMTIME:"商家确认时间",
	AREA_ID:"小区ID",
	CONSIGNEECITY:"收货市区",
	CONFIRMCONENT:"系统备注",
	SETTLEMENTSTATUS:"结算状态",
	CONSIGNEETEL:"收货电话",
	ORDER_ID:"订单id",
	BUILDINGNO:"收货人楼栋",
	DELIVERYMANDELETED:"配送端是否删除",
	CONSIGNEEDISTRICT:"收货县城",
	CONSIGNEEPROVINCE:"收货省市",
	STOREADDRESS:"店铺地址",
	TOTALFEE:"总金额(元)",
	RECEIVETIME:"送达时间",
	PAYTYPE:"支付方式"
}